<?php
namespace Mobile\Controller;
use Think\Controller;

class HomeBasicController extends Controller {

	public function _initialize(){

	}

	//ajax返回数据
	public function ajaxMsg($f,$m){
        $msg[$f] = $m;
        $this->ajaxReturn($msg,Json);
    }
    /**
     * 检查是否是以手机浏览器进入(IN_MOBILE)
     */
    public function isMobile() {
        $mobile = array ();
        static $mobilebrowser_list = 'Mobile|iPhone|Android|WAP|NetFront|JAVA|OperasMini|UCWEB|WindowssCE|Symbian|Series|webOS|SonyEricsson|Sony|BlackBerry|Cellphone|dopod|Nokia|samsung|PalmSource|Xphone|Xda|Smartphone|PIEPlus|MEIZU|MIDP|CLDC';
// note 获取手机浏览器
        if (preg_match ( "/$mobilebrowser_list/i", $_SERVER ['HTTP_USER_AGENT'], $mobile )) {
            return true;
        } else {
            if (preg_match ( '/(mozilla|chrome|safari|opera|m3gate|winwap|openwave)/i', $_SERVER ['HTTP_USER_AGENT'] )) {
                return false;
            } else {
                if ($_GET ['mobile'] === 'yes') {
                    return true;
                } else {
                    return false;
                }
            }
        }
    }

}

?>